package com.bamatea.reportfrom.service;

import com.bamatea.reportfrom.dao.IcGeneralAllWcMapper;
import com.bamatea.reportfrom.domain.IcGeneralAllWc;
import com.bamatea.reportfrom.domain.IcGeneralAllWcExample;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;

/**
 * @Auther: libingbing
 * @Date: 2020-04-26 10 :29
 * @Description: 库存2019年以后流水数据
 */
@Service
public class IcgeneralAllWcService {
    @Resource
    private IcGeneralAllWcMapper mapper;

    public List<IcGeneralAllWc> findByStartAndEnd(String start, String end) {
        IcGeneralAllWcExample example = new IcGeneralAllWcExample();
//        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
//        String start1 = formatter.format(start);
//        String end1 = formatter.format(end);
        example.or().andDbilldateBetween(start, end);
        return mapper.selectByExampleSelective(example, IcGeneralAllWc.Column.invcode,IcGeneralAllWc.Column.ninnum,IcGeneralAllWc.Column.noutnum);
    }

    public List<IcGeneralAllWc> findByCatId(String invclasscode) {
        IcGeneralAllWcExample example = new IcGeneralAllWcExample();
        example.or().andInvclasscodeEqualTo(invclasscode);
        return mapper.selectByExampleSelective(example);
    }

    public List<IcGeneralAllWc> findOne(){
        IcGeneralAllWcExample example = new IcGeneralAllWcExample();
        PageHelper.startPage(1,100);
        return mapper.selectByExample(example);
    }
    public List<IcGeneralAllWc> findBycodes(List<String> code){
        IcGeneralAllWcExample example = new IcGeneralAllWcExample();
        example.or().andInvclasscodeIn(code);
        return mapper.selectByExample(example);
    }


}
